import Vue from "vue";
import VueRouter from "vue-router";

import Layout from "@/layout"; //布局页

Vue.use(VueRouter);

// 通用页面, 这里的配置不需要权限
export const constRouter = [
  {
    path: "/login", 
    component: () => import("@/views/login/Login"),
    hidden: true, //导航菜单忽略选项
  },
  {
    path: "",
    component: Layout, //应用布局页
    redirect: "/modelList",
    hidden: true,
  },
  {
    path: "/nulled",
    component: () => import("@/views/login/null"),
    hidden: true, //导航菜单忽略选项
  },
  {
    path: "/go",
    component: () => import("@/views/login/go"),
    hidden: true, //导航菜单忽略选项
  },
  {
    path: "/model",
    component: Layout, //应用布局页
    name: "model",
    children: [
      {
        path: "/modelList",
        component: () => import("@/views/modelList/list.vue"),
        name: "modelList",
        meta: {
          title: "产品信息",
          icon: "el-icon-s-home",
          roles: ["admin", "jerry"],
        },
      },
    ],
  },
  {
    path: "/productSummary",
    component: Layout, //应用布局页
    name: "productSummary",
    children: [
      {
        path: "/productSummary",
        component: () => import("@/views/productSummary/list.vue"),
        name: "productSummary",
        meta: {
          title: "产品汇总",
          icon: "el-icon-s-home",
          roles: ["admin", "jerry"],
        },
      },
    ],
  },
  // {
  //   path: "/maintenance",
  //   component: Layout, //应用布局页
  //   name: "maintenance",
  //   children: [
  //     {
  //       path: "/maintenanceList",
  //       component: () => import("@/views/maintenance/list.vue"),
  //       name: "maintenanceList",
  //       meta: {
  //         title: "现场运维",
  //         icon: "el-icon-s-home",
  //         roles: ["admin", "jerry"],
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/afterSales",
  //   component: Layout, //应用布局页
  //   name: "afterSales",
  //   children: [
  //     {
  //       path: "/afterSalesList",
  //       component: () => import("@/views/afterSales/list.vue"),
  //       name: "afterSalesList",
  //       meta: {
  //         title: "视频指导",
  //         icon: "el-icon-s-home",
  //         roles: ["admin", "jerry"],
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/feedback",
  //   component: Layout, //应用布局页
  //   name: "feedback",
  //   children: [
  //     {
  //       path: "/feedbackList",
  //       component: () => import("@/views/feedback/list.vue"),
  //       name: "feedbackList",
  //       meta: {
  //         title: "用户反馈",
  //         icon: "el-icon-s-home",
  //         roles: ["admin", "jerry"],
  //       },
  //     },
  //   ],
  // },
  {
    path: "/complex",
    component: Layout,
    redirect: "afterSalesList",
    meta: {
      title: "综合",
      icon: "el-icon-s-goods",
      hidden: false,
    },
    children: [
      {
        path: "/afterSalesList",
        component: () => import("@/views/afterSales/list.vue"),
        name: "afterSalesList",
        meta: {
          title: "视频指导",
          icon: "el-icon-s-home",
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "/maintenanceList",
        component: () => import("@/views/maintenance/list.vue"),
        name: "maintenanceList",
        meta: {
          title: "现场运维",
          icon: "el-icon-s-home",
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "/feedbackList",
        component: () => import("@/views/feedback/list.vue"),
        name: "feedbackList",
        meta: {
          title: "用户反馈",
          icon: "el-icon-s-home",
          roles: ["admin", "jerry"],
        },
      },
      
    ],
  },
  {
    path: "/feedback",
    component: Layout, //应用布局页
    name: "feedback",
    children: [
     {
        path: "/modeltree",
        component: () => import("@/views/goods/modeltree.vue"),
        name: "modeltree",
        meta: {
          title: "项目管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
    ],
  },
  {
    path: "/goods",
    component: Layout,
    redirect: "/goods/user",
    meta: {
      title: "系统管理",
      icon: "el-icon-s-goods",
      hidden: false,
    },
    children: [
      {
        path: "user",
        component: () => import("@/views/goods/user.vue"),
        name: "goods/user",
        meta: {
          title: "用户管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "menu",
        component: () => import("@/views/goods/menu.vue"),
        name: "goods/menu",
        meta: {
          title: "菜单管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "wxmenu",
        component: () => import("@/views/goods/wxmenu.vue"),
        name: "goods/wxmenu",
        meta: {
          title: "微信菜单管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "role",
        component: () => import("@/views/goods/role.vue"),
        name: "goods/role",
        meta: {
          title: "角色管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "approver",
        component: () => import("@/views/goods/approver.vue"),
        name: "goods/approver",
        meta: {
          title: "流程管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
      {
        path: "log",
        component: () => import("@/views/goods/log.vue"),
        name: "goods/log",
        meta: {
          title: "日志管理",
          icon: "el-icon-tickets",
          hidden: false,
          roles: ["admin", "jerry"],
        },
      },
    ],
  },
];

// 动态路由 communication
export const asyncRoutes = [];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes: constRouter,
});

export default router;
